
<p id="demo"> </p>
<p id="demo2"  onclick="this.innerHTML=Date()">The time is? </p>
<p id="demo3"> </p>
<p id="demo4"> </p>
<p id="demo5"> </p>





<script>
		var obj = {name:"car",color:"white",type:"post"}

		var person ={
			firstName: "John",
			lastName: "Doe",
			id: 5566,

			fullName :function(){
				return this.firstName + " " +this.lastName;
			}
		}

		document.getElementById("demo").innerHTML = person.fullName();

var x = 'It\'s alright';

var y = "He is called \"John\"";

document.getElementById("demo3").innerHTML = x+" "+y;

var txt = "asgawertgqwrjasdfj123412";

var sln = txt.lenght;
var pln = txt[5];

//alert(pln);


//json 格式
var text2 = '{"employees":['+
	'{"firstName":"Jhon0", "lastName":"wubuze"},'+
	'{"firstName":"Jhon1", "lastName":"wubuze"},'+
	'{"firstName":"Jhon2", "lastName":"wubuze"}]}';

// [] 数组 {} 对象
var ojb2 = JSON.parse(text2); //json -> 对象

	document.getElementById("demo5").innerHTML = ojb2.employees[1].firstName;


console.log(JSON.stringify(ojb2)); // JSON.stringify  把对象转换成json


//
var x = function (a,b){ return a*b};
var z = x(5,6);
//alert(z);


//自调用   函数表达式可以自调用 
//最外面的括号表示 它是一个函数表达式  最后的括号表示自调用
(function (){
	//document.getElementById("demo").innerHTML = "Hellow! 我是自己调用的e";

})();


//默认参数
function myFunciton (x,y){
	y = y || 0;
}


//arguments 对象
function findMax(){
	var i, max = 0;
	for (i = 0; i < arguments.length; i++) {
		if(arguments[i] > max){
			max = arguments[i];
		}
	}

	return max;
}

document.getElementById("demo").innerHTML  = findMax(1,123,500,44,88);


</script>